package com.lcz.demo.customerorder;

import com.lcz.demo.infoapp.InfoApp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

@Configuration
public class CustomerConfiguration {
    @Value("${app.useFakeCustomRepo:false}")
    private Boolean useFakeCustomRepo;
    @Value("{info.company.name}")
    private String companyName;
    @Autowired
    private Environment environment;

   @Autowired
   private InfoApp infoApp;
    @Bean
     CommandLineRunner commandLineRunner(){
         return args -> {
             System.out.println("sss");
             System.out.println(companyName);
             System.out.println(environment.getProperty("info.app.verion"));
             System.out.println(infoApp);
         };
     }
     @Bean
     CustomRepo customRepo(){
        System.out.println("useFakeCustomRepo "+useFakeCustomRepo);
        return  new CustomerFakeDAO();

    }

}
